package com.wuyou.sso.common.enums;

import cn.hutool.core.util.EnumUtil;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.wuyou.sso.common.annotation.DictValue;
import com.wuyou.sso.common.annotation.Label;
import com.wuyou.sso.common.annotation.MapDict;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * 菜单类型
 *
 * @author lishangbu
 * @date 2021/2/23
 */
@RequiredArgsConstructor
@MapDict(code = "menu-type",name = "菜单类型")
public enum MenuTypeEnum implements IEnum<Integer> {
    /**
     * 菜单
     */
    @Label("菜单")
    MENU(0, "菜单"),
    /**
     * 按钮
     */
    @Label("按钮")
    BUTTON(1, "按钮");

    /**
     * 类型
     */
    @DictValue
    private final Integer type;

    /**
     * 描述
     */
    @JsonValue
    @Getter
    private final String description;

    @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
    public static MenuTypeEnum getEnum(Object value) {
        return EnumUtil.likeValueOf(MenuTypeEnum.class, value);
    }

    @Override
    public Integer getValue() {
        return this.type;
    }

}
